import { mockInterfaceModel } from './types'

// 首先引入Mock
import Mock from 'mockjs'

// 设置拦截ajax请求的相应时间
Mock.setup({
  timeout: '200-600'
})

const files = import.meta.globEager("./*.ts")
const modules: any = {};
for (const key in files) {
    if (Object.prototype.hasOwnProperty.call(files, key)) {
        modules[key.replace(/(\.\/|\.ts)/g, '')] = files[key].default
    }
}
let configArray:Array<any>= []
for(let key in modules){
  if (key != 'index' && key != 'types'){
    configArray = configArray.concat(modules[key])
  }
}
configArray.forEach((item: any) => {
  let url = item.url
  Mock.mock(RegExp(url + '.*'), item.method, (options: any) => {
    return Mock.mock(item.response)
  })
})



